Refactor Input Handling and Improve Agent Robustness#147
Merged
Conversation
- Move router agent orchestration from Application.process_input to new InputHandler.route method - Add lazy import for CommandInterpretationAgent in agents/__init__.py - Improve variable handling in agent_tools web_search and web_scrape_url functions - Add comprehensive tests for InputHandler in tests/test_input_handler.py
…uard against None text in TUI - research_agent now retries once if JSON parsing fails, summarising findings and aborting gracefully on repeated failure - textual_ui skips printing when event.text is None to prevent downstream errors
…iants - Removes deprecated Anthropic, OpenAI and OpenRouter models - Adds new Claude Haiku 4.5, Sonnet 4.5 and Opus 4.1 entries - Introduces GPT-5, GPT-5-mini and GPT-5-nano with updated pricing/context - Replaces all profile mappings to use gpt-5-mini as the default model
- Upgrade OpenAI models from o4-mini and gpt-4.1 variants to gpt-5-mini - Update Anthropic models to latest claude-sonnet-4-5 and claude-haiku-4-5 versions - Standardize Qwen models to use qwen3-coder across all profiles - Improve test isolation by configuring git environment to prevent external interference
Add pytest configuration to handle async test functions without external plugins. The implementation detects coroutine functions and runs them using asyncio.run, providing basic async testing capabilities similar to pytest-asyncio.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview: This pull request introduces a structural refactoring to the application's core input processing logic and enhances the resilience of the Research Agent. The primary change is the extraction of the natural language routing loop from the main
Applicationclass into a new, dedicatedInputHandlerclass. This improves separation of concerns, simplifies the application's main entry point, and enhances testability. Additionally, the Research Agent is now more robust against intermittent LLM failures, and the list of available models has been updated.What This Means for Users:
A Closer Look at the Changes:
Code Refinements & Improvements:
Application.process_inputinto a newInputHandlerclass. This change clarifies responsibilities within the application core and is accompanied by a new suite of unit tests (test_input_handler.py) for the extracted logic.ResearchAgentnow includes a retry mechanism. If it fails to parse the JSON response from the LLM, it will make a second attempt. If the second attempt also fails, it constructs a summary of the tool calls made up to that point and concludes the task, preventing a hard crash.jrdev.agentspackage now uses__getattr__to lazy-load agents, improving startup time and code organization.Nonecheck has been added intextual_ui.pyto prevent potential errors when processing text events.web_searchagent tool now handles empty or whitespace-only queries more gracefully.Configuration Updates:
model_list.jsonconfiguration has been significantly updated. Outdated models have been removed, and new models, including the GPT-5 series and latest Claude versions, have been added.gpt-5-minito align with the new model list.Generated by JrDev AI using gemini-2.5-pro